<?php

class Adb
{

  protected static $db;

  protected $name;

  protected function __construct($name)
  {
    $this->name = $name;
  }

  public function getName()
  {
    return $this->name;
  }

  protected function db()
  {
    if (empty(self::$db)) {
      self::$db = DAO::getInstance()->db();
      self::$db->loadModule('Manager');
      self::$db->loadModule('Reverse');
    }
    
    return self::$db;
  }

  /**
   * 
   * @return MDB2_Driver_Manager_Common
   */
  protected function manager()
  {
    return $this->db()->manager;
  }

  /**
   * 
   * @return MDB2_Driver_Reverse_Common
   */
  protected function reverse()
  {
    return $this->db()->reverse;
  }

}
